package com.cooper.mediadb.online;

import java.io.Serializable;

import com.cooper.scrapemedialib.R;

public class MediaSource implements Comparable<MediaSource>, Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1910538008962934764L;

	private String url;
	
	private String title;

	private int src;

	private int order;
	
	public MediaSource(String url,int src){
		this.url = url;
		this.src = src;
	}

	public MediaSource(String url,String title, int src) {
		this.url = url;
		this.src = src;
		this.title = title;
	}

	public MediaSource(String url,String title, int src, int order) {
		this.url = url;
		this.src = src;
		this.order = order;
		this.title = title;
	}

	public int getOrder() {
		return order;
	}

	public String getUrl() {
		return url;
	}

	public int getSrc() {
		return src;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public int getIconResId(){
		int result = R.drawable.ic_src_internet;
		switch (src) {
		case MediaSrcMgr.SRC_LETV:
			result = R.drawable.ic_src_letv;
			break;
		case MediaSrcMgr.SRC_M1905:
			result = R.drawable.ic_src_m1905;
			break;
		case MediaSrcMgr.SRC_PPTV:
			result = R.drawable.ic_src_pptv;
			break;
		case MediaSrcMgr.SRC_QIYI:
			result = R.drawable.ic_src_qiyi;
			break;
		case MediaSrcMgr.SRC_QQ:
			result = R.drawable.ic_src_qq;
			break;
		case MediaSrcMgr.SRC_SINA:
			result = R.drawable.ic_src_sina;
			break;
		case MediaSrcMgr.SRC_SOHU:
			result = R.drawable.ic_src_sohu;
			break;
		case MediaSrcMgr.SRC_TUDOU:
			result = R.drawable.ic_src_tudou;
			break;
		case MediaSrcMgr.SRC_YOUKU:
			result = R.drawable.ic_src_youku;
			break;
		case MediaSrcMgr.SRC_MTIME:
			result = R.drawable.ic_src_mtime;
			break;
		case MediaSrcMgr.SRC_UNKNOW:
			result = R.drawable.ic_src_internet;
			break;
		case MediaSrcMgr.SRC_FUNSHION:
			result = R.drawable.ic_src_funshion;
			break;
		case MediaSrcMgr.SRC_XUNLEI:
			result = R.drawable.ic_src_xunlei;
			break;
		case MediaSrcMgr.SRC_PPS:
			result = R.drawable.ic_src_pps;
			break;
		case MediaSrcMgr.SRC_WASU:
			result = R.drawable.ic_src_wasu;
			break;
		case MediaSrcMgr.SRC_56:
			result = R.drawable.ic_src_56;
			break;
		case MediaSrcMgr.SRC_CNTV:
			result = R.drawable.ic_src_cntv;
			break;
		case MediaSrcMgr.SRC_V61:
			result = R.drawable.ic_src_v61;
			break;
		case MediaSrcMgr.SRC_YUGAOPIAN:
			result = R.drawable.ic_icon;
			break;
		}	
		return result;		
	}
	
	public int getLogoResId() {
		int result = R.drawable.src_ic_internet;
		switch (src) {
		case MediaSrcMgr.SRC_LETV:
			result = R.drawable.src_ic_letv;
			break;
		case MediaSrcMgr.SRC_M1905:
			result = R.drawable.src_ic_m1905;
			break;
		case MediaSrcMgr.SRC_PPTV:
			result = R.drawable.src_ic_pptv;
			break;
		case MediaSrcMgr.SRC_QIYI:
			result = R.drawable.src_ic_qiyi;
			break;
		case MediaSrcMgr.SRC_QQ:
			result = R.drawable.src_ic_qq;
			break;
		case MediaSrcMgr.SRC_SINA:
			result = R.drawable.src_ic_sina;
			break;
		case MediaSrcMgr.SRC_SOHU:
			result = R.drawable.src_ic_sohu;
			break;
		case MediaSrcMgr.SRC_TUDOU:
			result = R.drawable.src_ic_tudou;
			break;
		case MediaSrcMgr.SRC_YOUKU:
			result = R.drawable.src_ic_youku;
			break;
		case MediaSrcMgr.SRC_MTIME:
			result = R.drawable.src_ic_mtime;
			break;
		case MediaSrcMgr.SRC_UNKNOW:
			result = R.drawable.src_ic_internet;
			break;
		case MediaSrcMgr.SRC_FUNSHION:
			result = R.drawable.src_ic_funshion;
			break;
		case MediaSrcMgr.SRC_XUNLEI:
			result = R.drawable.src_ic_xunlei;
			break;
		case MediaSrcMgr.SRC_PPS:
			result = R.drawable.src_ic_pps;
			break;
		case MediaSrcMgr.SRC_WASU:
			result = R.drawable.src_ic_wasu;
			break;
		case MediaSrcMgr.SRC_56:
			result = R.drawable.src_ic_56;
			break;
		case MediaSrcMgr.SRC_CNTV:
			result = R.drawable.src_ic_cntv;
			break;
		case MediaSrcMgr.SRC_V61:
			result = R.drawable.src_ic_v61;
			break;
		case MediaSrcMgr.SRC_YUGAOPIAN:
			result = R.drawable.ic_icon;
			break;
		}
		return result;
	}

	@Override
	public int compareTo(MediaSource another) {
		return Integer.valueOf(order).compareTo(Integer.valueOf(another.getOrder()));
	}

}
